#include<iostream>
#include<vector>
#include<string>
#include<unordered_map>
using namespace std;
 
class Solution {
public:
	int removeDuplicates(vector<int>& nums) {
		int size = nums.size();
		for (int i = 0; i < nums.size(); i++) {
			while (i+2<nums.size()&&nums[i+2]==nums[i]) {
				nums.erase(nums.begin() + i + 2);
				size--;
			}
		}
		return size;
	}
};

int main() {
	vector<int> arr = { 1,2,2,2,2,3,4,5,5,5,5 };
	vector<int>::iterator it = arr.end();
	//vector<int>::iterator test = it + 2;
	Solution s;
	s.removeDuplicates(arr);
} 